import Http from "~/apis/utils/http";

export default new (class book_rent_record extends Http {
  getAll() {
    return this.get("rentRecord/all");
  }

  filterData(params?: any) {
    return this.post("rentRecord/filter", params);
  }

  getTreeData(params?: any) {
    return this.get("rentRecord/page/tree", params);
  }

  deleteById(id: any) {
    return this.delete(`rentRecord/delete/${id}`);
  }

  deleteMany(ids: any) {
    return this.post("rentRecord/deleteMany", { ids: ids });
  }

  update(model: any) {
    return this.post("rentRecord/update", model);
  }

  create(model: any) {
    return this.post("rentRecord/create", model);
  }

  borrow(recordId: any) {
    return this.post(`rentRecord/borrowBook/yes/${recordId}`);
  }

  disBorrow(recordId: any) {
    return this.post(`rentRecord/borrowBook/no/${recordId}`);
  }

  giveBack(recordId: any) {
    return this.post(`rentRecord/returnBook/${recordId}`);
  }

  reRent(recordId: any) {
    return this.post(`rentRecord/reRentRecord/${recordId}`);
  }

  loadReRentRecords(recordId: any) {
    return this.post("reRentRecord/filter", {
      pageIndex: 1,
      pageSize: 10,
      rentRecordId: recordId,
    });
  }
})();
